package xju_5_6.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import xju_5_6.entity.Stu;

@Repository // 指定为bean
public class StuDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void insert(Stu stu) {
        String sql = "insert into student (name,sn,card_id,clazz_id) values (?,?,?,?)";
        jdbcTemplate.update(sql,stu.getName(),stu.getSn(),stu.getCardId(),stu.getClazzId());
    }
}
